const path = require("path");
const fs = require("fs");

function read_file(file_name) {
    file_path = path.join(__dirname, "static", file_name);
    data = fs.readFileSync(file_path, "utf-8");
    return JSON.parse(data);
}

function write_file(file_name, data){
    file_path = path.join(__dirname, "static", file_name);
    fs.writeFile(file_path, data, {'flag': 'w'}, (err)=>{ console.log(err) })
}

module.exports = {
    read_file,
    write_file
};